﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadFileNew.aspx.cs" Inherits="HumanResorcesProj.GUI.Extensions.UploadFileNew" MasterPageFile="~/GUI/MasterOfPopUps.Master" %>

<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">

<div> 

</div>

<div dir="rtl" 
        style="background-image: url('../pic/7.png'); width: 755px; height: 340px;">
    
                <br />
                <table dir="rtl" style="width:100%;">
                    <tr style="font-weight: bold;">
                        <td style="width: 249px">
                            </td>
                        <td align="left" style="width: 135px">
                            שם העובד:&nbsp;
                        </td>
                        <td style="width: 112px">
                            <asp:Label ID="NameLabel1" runat="server" Text="NameLabel" 
                                style="text-decoration: underline"></asp:Label>
                        </td>
                        <td align="left" style="width: 213px">
                            תז:&nbsp;
                        </td>
                        <td>
                            <asp:Label ID="IDLabel" runat="server" Text="IDLabel" 
                                style="text-decoration: underline"></asp:Label>
                        </td>
                        <td>
	<asp:HyperLink runat="server" ID="ctrResult" Target="_blank" />
                        </td>
                        <td>
                            </td>
                    </tr>
                    <tr>
                        <td style="width: 249px; color: #FF0000; text-decoration: underline;" 
                            align="left">
                            תיאור הקובץ</td>
                        <td colspan="3">
                <asp:TextBox ID="FileInfoTextBox" runat="server" Width="361px" Height="20px" 
                                ToolTip="בשדה זה יש לרשום תיאור מילולי של הקובץ בכדי שיופע משהו בטבלת הארכיון"></asp:TextBox>
                        </td>
                        <td align="center" dir="rtl">
    
                <asp:FileUpload runat="server" ID="ctrFile" Font-Bold="False" Font-Italic="False" 
                                ToolTip="בחירת קובץ להעלה" Width="235px" /> 
                        </td>
                        <td>
                        
                            <asp:Button ID="btnUploadFile" runat="server" Text="שמור קובץ" Font-Bold="True" 
                                Font-Strikeout="False" Font-Underline="True" 
                                ToolTip="לחץ בכדי להעלות את הקובץ לשרת" />
	                    </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                </table>
                <br />
   
     <table>
     <tr>
     <td style="width: 44px">&nbsp;</td>
     <td> 
       <asp:GridView ID="GridView1" runat="server"
     AutoGenerateColumns="False" 
        DataKeyNames="FileId" 
        DataSourceID="SqlDataSource1" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" 
        AllowPaging="True" 
        AllowSorting="True" 
        
        GridLines="None" BackColor="LightGoldenrodYellow" BorderColor="Tan" 
             BorderWidth="1px" CellPadding="2" ForeColor="Black" style="text-align: center" 
             Width="712px" PageSize="6">
        
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="עדכן"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="בטל"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="ערוך"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Select" Text="בחר"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False"
                    OnClientClick="return confirm('נא אשר מחיקה');"  
                        CommandName="Delete" Text="מחק"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="FileInfo" HeaderText="תיאור קובץ" 
                SortExpression="FileInfo" >
            <ItemStyle Font-Underline="False" />
            </asp:BoundField>
            <asp:BoundField DataField="FileSize" HeaderText="גודל" 
                SortExpression="FileSize" ReadOnly="True" />
            <asp:BoundField DataField="FileName" HeaderText="שם קובץ" 
                SortExpression="FileName" ReadOnly="True" />
            <asp:BoundField DataField="FileId" HeaderText="FileId" ReadOnly="True" 
                SortExpression="FileId" Visible="False" />
            <asp:BoundField DataField="FileType" HeaderText="FileType" 
                SortExpression="FileType" Visible="False" />
            <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" 
                Visible="False" />
        </Columns>
        <FooterStyle BackColor="Tan" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
               HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
        DeleteCommand="DELETE FROM [File] WHERE [FileId] = @original_FileId " 
        InsertCommand="INSERT INTO [File] ([FileId], [FileName], [FileType], [FileSize], [FileContent], [UserId], [FileInfo]) VALUES (@FileId, @FileName, @FileType, @FileSize, @FileContent, @UserId, @FileInfo)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [File] WHERE ([UserId] = @UserId)" 
        
                    
                    UpdateCommand="UPDATE [File] SET FileInfo = @FileInfo WHERE (FileId = @original_FileId)">
        <SelectParameters>
            <asp:ControlParameter ControlID="IDLabel" Name="UserId" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="original_FileId" Type="Object" />
            <asp:Parameter Name="original_FileName" Type="String" />
            <asp:Parameter Name="original_FileType" Type="String" />
            <asp:Parameter Name="original_FileSize" Type="Int32" />
            <asp:Parameter Name="original_FileContent" Type="Object" />
            <asp:Parameter Name="original_UserId" Type="String" />
            <asp:Parameter Name="original_FileInfo" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="FileName" Type="String" />
            <asp:Parameter Name="FileType" Type="String" />
            <asp:Parameter Name="FileSize" Type="Int32" />
            <asp:Parameter Name="FileContent" Type="Object" />
            <asp:Parameter Name="UserId" Type="String" />
            <asp:Parameter Name="FileInfo" Type="String" />
            <asp:Parameter Name="original_FileId" Type="Object" />
            <asp:Parameter Name="original_FileName" Type="String" />
            <asp:Parameter Name="original_FileType" Type="String" />
            <asp:Parameter Name="original_FileSize" Type="Int32" />
            <asp:Parameter Name="original_FileContent" Type="Object" />
            <asp:Parameter Name="original_UserId" Type="String" />
            <asp:Parameter Name="original_FileInfo" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="FileId" Type="Object" />
            <asp:Parameter Name="FileName" Type="String" />
            <asp:Parameter Name="FileType" Type="String" />
            <asp:Parameter Name="FileSize" Type="Int32" />
            <asp:Parameter Name="FileContent" Type="Object" />
            <asp:Parameter Name="UserId" Type="String" />
            <asp:Parameter Name="FileInfo" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>  
     </td>
       <td>&nbsp;</td>
     </tr>
     
     </table>           
  
    </div>           

</asp:Content>
